People who have some background in any Object-oriented

programming, must be aware that OOP has four basic concepts,

which are as follows:

Encapsulation

Abstraction

Inheritance

Polymorphism

Now, let’s explore these features one by one.

2.5.20.1 Encapsulation

Encapsulation or data hiding is a process where the data and the

function that gives access to the data work as a single unit. Data in

Solidity, by default, is of private visibility and the functions that give

access to the data are public.

Refer to the following code:

// SPDX-License-Identifier: SOME IDENTIFIER

pragma solidity ^0.8.10;

// A simple contract with getter and setter functions

contract GetterSetterContract {

string value = “Some Value”;

function getValue() public view returns(string memory) {

return value;

}

function setValue(string memory newValue) public {

value = newValue;

}

}

2.5.20.2 Abstraction

Abstraction is a process where the implementation details are

hidden, and only the essential information are shown. In Solidity,